package persistencia;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conn
{
	protected String jdbc;
	protected String servidor;
	protected String usuario;
	protected String password;
	
	public Conn()
	{
		
	}
	
	public Connection getConnection(){
		return connect();
	}
	
	

	private Connection connect()
	{
		try
		{
			jdbc = "jdbc:sqlserver://"; 
		    servidor = "192.168.6.100:1433";
	        usuario = "";
	        password = "";
		       
			Class.forName ("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance ();
            String dbConnectString = jdbc + servidor; 
            Connection con = DriverManager.getConnection (dbConnectString, usuario, password);
            
            return con;
		}
		catch (SQLException e)
		{
			System.out.println("Mensaje Error: " + e.getMessage());
			System.out.println("Stack Trace: " + e.getStackTrace());
			return null;
		}
		catch (Exception ex)
		{
			System.out.println("Mensaje Error: " + ex.getMessage());
			System.out.println("Stack Trace: " + ex.getStackTrace());
			return null;
		}
	}

}
